<?php

/**
 * Extra Javascript code required
 * for Google FriendConnect
 *
 */
class tplGfcCode extends StudyBuddy\Template\Template
{
	protected static $vars = array('id' => '');

	protected static $tpl = '
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
  google.load(\'friendconnect\', \'0.8\');
</script>
<script type="text/javascript"> 
	var initGfc = function(times) {
		if (times > 1) {
			 window.top.location.reload(true);
			}
		};
			
	var onFriendConnectInitialized = function(st) {
				if(!window.friendconnect_times_loaded) {
					window.friendconnect_times_loaded = 1;
				} else {
					window.friendconnect_times_loaded++;
				}
				
				initGfc(window.friendconnect_times_loaded);
	};

	google.friendconnect.container.loadOpenSocialApi( {
	site : \'%1$s\',
	onload : onFriendConnectInitialized
	});	
</script>';

}
